package org.atguigu.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 海晨忆
 * @Des 线索模块Controller
 * @Date 2025/8/4 15:10
 */
@RestController
public class ClueController {
    /**
     * 线索管理菜单
     * 线索管理子菜单
     * 线索管理-列表
     * 线索管理-录入
     * 线索管理-编辑
     * 线索管理-查看
     */

    @RequestMapping("/api/clue/index")
    public String clueIndex() {
        return "clueIndex";
    }

    //需要saler角色，才能调用此接口
//    @PreAuthorize("hasRole('saler')")
    @RequestMapping("/api/clue/menu")
    public String clueMenu() {
        return "clueMenu";
    }

    //    @PreAuthorize("hasRole('saler')")
    @RequestMapping("/api/clue/menu/child")
    public String clueMenuChild() {
        return "clueMenuChild";
    }

    //    @PreAuthorize("hasRole('saler')")
    @PreAuthorize("hasAuthority('clue:list')")
    @RequestMapping("/api/clue/list")
    public String clueList() {
        return "clueList";
    }

    //    @PreAuthorize("hasRole('saler')")
    @PreAuthorize("hasAuthority('clue:add')")
    @RequestMapping("/api/clue/input")
    public String clueInput() {
        return "clueInput";
    }

    //    @PreAuthorize("hasRole('saler')")
    @PreAuthorize("hasAuthority('clue:edit')")
    @RequestMapping("/api/clue/edit")
    public String clueEdit() {
        return "clueEdit";
    }

    //    @PreAuthorize("hasRole('saler')")
    @PreAuthorize("hasAuthority('clue:view')")
    @RequestMapping("/api/clue/view")
    public String clueView() {
        return "clueView";
    }

    //需要admin角色，才能调用此接口
//    @PreAuthorize("hasRole('admin')")
    @PreAuthorize("hasAuthority('clue:del')")
    @RequestMapping("/api/clue/del")
    public String clueDel() {
        return "clueDel";
    }

    //需要admin角色或者manager角色，才能调用此接口
//    @PreAuthorize("hasAnyRole('admin','manager')")
    @PreAuthorize("hasAnyAuthority('clue:export','clue:download')")
    @RequestMapping("/api/clue/export")
    public String clueExport() {
        return "clueExport";
    }
}
